<?php
/* @var $this LibraryController */
/* @var $model Library */
/* @var $form bootstrap.widgets.TbActiveForm */
?>


<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(
	'id'=>'library-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>false,
)); ?>

	<p class="help-block">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

		<?php echo $form->textFieldRow($model,'name',array('class'=>'span3','maxlength'=>255)); ?>
		<?php echo $form->textFieldRow($model,'slug',array('class'=>'span3','maxlength'=>255)); ?>
		<?php echo $form->labelEx($model,'gameId'); ?>
		<?php $this->widget('application.extensions.autocomplete.EJuiAutoCompleteFkField', array(
			 'model'=>$model, 
			 'attribute'=>'gameId', //the FK field (from CJuiInputWidget)
			 // controller method to return the autoComplete data (from CJuiAutoComplete)
			 'sourceUrl'=>Yii::app()->createUrl('/game/findGame'), 
			 'relName'=>'game', // the relation name defined above
			 'displayAttr'=>'GameDisplay',
		)); ?>
		<?php echo $form->error($model,'gameId'); ?>

		<?php echo $form->dropDownListRow($model,'cabinetId',$model->getCabinetOptions()); ?>

		<?php echo $form->textFieldRow($model,'shelf',array('class'=>'span3','maxlength'=>255)); ?>

		<?php echo $form->labelEx($model,'parentId'); ?>
		<?php $this->widget('application.extensions.autocomplete.EJuiAutoCompleteFkField', array(
			 'model'=>$model, 
			 'attribute'=>'parentId', //the FK field (from CJuiInputWidget)
			 // controller method to return the autoComplete data (from CJuiAutoComplete)
			 'sourceUrl'=>Yii::app()->createUrl('/library/findBaseGame'), 
			 'relName'=>'baseGame', // the relation name defined above
			 'displayAttr'=>'GameDisplay',
		)); ?>
		<?php echo $form->error($model,'parentId'); ?>
		<?php echo $form->textFieldRow($model,'donor',array('class'=>'span3','maxlength'=>255)); ?>


	<div class="form-actions">
		<?php $this->widget('bootstrap.widgets.TbButton', array(
			'buttonType'=>'submit',
			'type'=>'primary',
			'label'=>$model->isNewRecord ? 'Create' : 'Save',
		)); ?>
	</div>

<?php $this->endWidget(); ?>
